﻿@model IEnumerable<SCMS.UI.Models.SalaryPItems>
<br />
<script src="@Url.Content("~/Scripts/js/ajax.js")" type="text/javascript"></script>
<div class="partialViewCard">
    <div class="partialViewCardHeader">
        <h3>
            Payroll Items</h3>
    </div>
    &nbsp;&nbsp;&nbsp;
    @Ajax.ActionLink("New Item", "LoadSalaryPItem", new { id = ViewBag.SPID + "~" + ViewBag.CurrencyId }, new AjaxOptions
    {
        OnBegin = "ShowDialogue('Create Payroll Item')",
        UpdateTargetId = "popup-page",
        LoadingElementId = "popup-loading",
        Url = Url.Action("LoadSalaryPItem/" + ViewBag.SPID + "~" + ViewBag.CurrencyId),
        OnSuccess = "CenterPopup"
    })
    <br />
    @if (Model.Count() > 0)
    {
        <table width="98%" align="center" class="cardTable" cellspacing="0" cellpadding="0"
            border="1">
            <tr class="gridheader">
                <th>
                    Item Name
                </th>
                <th>
                    Project No.
                </th>
                <th>
                    Budget Line
                </th>
                <th>
                    Amount
                </th>
                @* <th>
                    Manage
                </th>*@
            </tr>
            @foreach (var item in Model)
            {
                <tr class="gridodd">
                    <td>
                        @item.EntitySalaryPBL.PayrollItem.Name
                    </td>
                    <td align="center">
                        @item.EntitySalaryPBL.ProjectBudget.BudgetCategory.ProjectDonor.ProjectNumber
                    </td>
                    <td align="center">
                        @item.EntitySalaryPBL.ProjectBudget.LineNumber
                    </td>
                    <td align="right">
                        @item.EntitySalaryPBL.Amount.ToString("##,##0.00")
                    </td>
                    <td>
                        @* @Ajax.ActionLink("Edit", "Index", new { id = "EditItem" }, new AjaxOptions
                        {
                            OnBegin = "ShowDialogue('Edit OR Item')",
                            UpdateTargetId = "popup-page",
                            LoadingElementId = "popup-loading",
                            Url = Url.Action("EditItem/" + item.EntityOrderRequestItem.Id),
                            OnSuccess = "CenterPopupPO"
                        })*@
                    </td>
                </tr>
            }
        </table>
    }
    <input type="hidden" id="actionStatus" value="@ViewBag.Response" />
    <input type="hidden" id="statusMsg" value="@ViewBag.msg" />
    <br />
    <input type="button" class="btn green" value="  Submit For Review  " onclick="sendRequest('SubmitSPM/@ViewBag.SPID', 'SPtDiv', 'loading'); document.getElementById('SPItemDiv').innerHTML='';initSorter();sorter.size(50);" />
    <br />
</div>
